home *** CD-ROM | disk | FTP | other *** search
- /* SVD
- **
- ** DESCRIPTION
- ** SVD is a simple program to tell MSCDEX to change a
- ** drive's choice for the standard or coded character set
- ** volume descriptor.
- **
- ** Note: parsing is very simplistic and doesn't deal with
- ** case that much at this point in time.
- ** Error checking needs work.
- **
- ** USAGE
- ** SVD [<drive letter>:] [svd | std]
- */
- /*
- ** HISTORY:
- ** This was left out of previous releases.
- **
- ** 10/01/90 Resurrected -by- JohnYG (v1.0)
- ** Final (v1.0)
- */
-
- /* FR_Svd() -
- **
- ** INPUTS
- ** AX = 0x150E
- ** BX = 0 - Get Sense, 1 - Set Sense
- ** CX = CDROM Drive letter (A=0, B=1...Z=25)
- ** DX = 0
- **
- ** DESCRIPTION
- ** Returns or sets the default sense MSCDEX has for a cdrom drive
- ** with regard to it's treatment of discs with both an PVD and a
- ** recognized SVD.
- **
- ** OUTPUTS
- ** DH = 0 - Coded char sets not supported or coded char set not recognized
- ** 1 - Standard Volume descriptor is default
- ** 2 - Coded Char Set Volume descriptor is default
- ** DL = Recognized coded character set (only valid if DH = 2)
- ** 1 - Shift Kanji
- */
-
- #include <stdio.h>
- #include <ctype.h>
- #include <dos.h>
- #include <process.h>
- #include <string.h>
-
- /* Volume Descriptor Types */
- #define VDT_BOOT 0
- #define VDT_STANDARD 1
- #define VDT_CODED 2
- #define VDT_UNSPECIFIED 3
- #define VDT_TERMINATOR 0xff
-
- #define SVD_ISO646 0
- #define SVD_KANJI 1
-
- extern void report_drives(void);
- extern void main(int, char *[]);
-
- union REGS inregs;
- union REGS outregs;
- struct SREGS segregs;
-
- char drvs[26];
- int ndrv;
-
- void report_drives()
- {
- char far *d = drvs;
- int i;
-
- printf("There are %d CD-ROM drives\n", ndrv);
-
- inregs.x.ax = 0x150D; /* Get drive letters */
- segregs.es = FP_SEG(d);
- inregs.x.bx = FP_OFF(d); /* ES:BX points to buffer */
- int86x(0x2f, &inregs, &outregs, &segregs);
-
- i = 0;
- while (i < ndrv) {
- inregs.x.ax = 0x150E; /* Get/Set Volume Descriptor Sense */
- inregs.x.bx = 0x0000; /* Get value */
- inregs.x.cx = drvs[i];
- inregs.x.dx = 0;
- int86(0x2f, &inregs, &outregs);
- if (outregs.x.cflag)
- printf("error: Carry set!\n");
- if (outregs.x.dx == 0)
- printf("error: DX modified!\n");
-
- printf(" drive[%2d] = '%c' ", i, drvs[i] + 'A');
- if (outregs.h.dh == VDT_STANDARD)
- printf("STD\n");
- else
- printf("CODED %d %s\n", outregs.h.dl,
- outregs.h.dl == SVD_KANJI ? "KANJI" : "UNKNOWN");
- i++;
- }
- }
-
- void main(argc, argv)
- int argc;
- char *argv[];
- {
- char drv;
-
- /* Check if MSCDEX installed */
- inregs.x.ax = 0x1500; /* Get num drives */
- inregs.x.bx = 0; /* Set to zero */
- int86(0x2f, &inregs, &outregs);
- ndrv = outregs.x.bx; /* number of drives */
- if (ndrv == 0) {
- printf("MSCDEX is not installed.\n");
- exit(1);
- }
-
- inregs.x.ax = 0x150C; /* Get MSCDEX Version */
- inregs.x.bx = 0x0000; /* Default value */
- int86(0x2f, &inregs, &outregs);
- /* If it reports back 0, must be version 1.01 */
- if (outregs.x.bx == 0)
- outregs.x.bx = 0x0101;
-
- printf("MSCDEX version %d.%02d\n", outregs.h.bh, outregs.h.bl);
-
- /* This is just a guess...SVD will one day accompany
- ** MSCDEX like tools accompany DOS but we can't quite
- ** make it version specific yet.
- */
- if (outregs.h.bh > 3)
- printf("Possibly incompatible SVD and MSCDEX versions\n");
-
- if (argc == 1) {
- report_drives();
- exit(0);
- }
- /* Get drive letter, make lower case */
- drv = (char)((*argv[1]) | 0x20);
- if (drv < 'a' || drv > 'z') {
- printf("usage: SVD [<drive letter>:] [svd | std]\n");
- exit(1);
- }
- drv -= 'a'; /* normalize drive letter to 0 */
-
- inregs.x.ax = 0x150E; /* Get/Set Volume Descriptor Sense */
- inregs.x.bx = 0x0001; /* Set value */
- inregs.x.cx = drv;
- if (!strcmp("std", argv[2]) || !strcmp("STD", argv[2]))
- inregs.x.dx = (VDT_STANDARD << 8) + SVD_ISO646;
- else
- inregs.x.dx = (VDT_CODED << 8) + SVD_KANJI;
- int86(0x2f, &inregs, &outregs);
- report_drives();
- }
-